ifeq ($(OS),Windows_NT)
 RM = del 
else
 RM = rm -rf
endif

CC = gcc
CFLAG += -g -Wall
SKIPDEX_LIB = libskipdex.a
AR = ar rcu

SKIPDEX_CROE_O = skip_conf.o skip_data.o skip_file.o skip_readconf.o skip_table.o skip_baseindex.o
SKIPDEX_TEST_O = test_readconf.o test_data.o
TEST = $(foreach s, $(SKIPDEX_TEST_O), $(basename $(s)))


ALL: $(SKIPDEX_LIB) $(TEST)
	@echo ----bulid success----

$(TEST): $(SKIPDEX_TEST_O)
	$(CC) $(CFLAG) -o $(basename $@)  $(basename $@).c  $(SKIPDEX_LIB)
	
$(SKIPDEX_CROE_O):
	$(CC) $(CFLAG) -c -o $@  $(basename $@).c
	
$(SKIPDEX_LIB):  $(SKIPDEX_CROE_O)
	$(AR) $(SKIPDEX_LIB) $?
	
.PHONY : clean
clean:
	$(RM) $(SKIPDEX_CROE_O) $(SKIPDEX_TEST_O) $(SKIPDEX_CROE_O) $(TEST) $(SKIPDEX_LIB)